﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using EHTWebsite.Code;
using System.Text;

namespace EHTWebsiteProject.Controls
{
    public partial class VideoControl : System.Web.UI.UserControl
    {
        private int width = 218;

        // player height
        private int height = 200;

        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            int auto = 0;
            Boolean isVN = true;
            // generate script on page load
            DataSet dsVideos = VideoProvider.GetVideosForFrontEnd(isVN);
            Int32 amountOfVideos = dsVideos.Tables[0].Rows.Count;

            for (Int32 i = 0; i < amountOfVideos; ++i)
            {
                sb.Append("<div style='margin: 2px;'>" + YouTubeScript.Get(dsVideos.Tables[0].Rows[i]["VideoUrl"].ToString(), auto, width, height) + "</div>");

            }

            this.ltrVideo.Text = sb.ToString();
        }
    }
}